package cn.doyo.spring.test.common;

import cn.duyo.spring.beans.BeansException;
import cn.duyo.spring.beans.PropertyValue;
import cn.duyo.spring.beans.PropertyValues;
import cn.duyo.spring.beans.factory.ConfigurableListableBeanFactory;
import cn.duyo.spring.beans.factory.config.BeanDefinition;
import cn.duyo.spring.beans.factory.config.BeanFactoryPostProcessor;

/**
 * @author du
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService3");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();

        propertyValues.addPropertyValue(new PropertyValue("company", "变更为：重庆百货"));
    }
}
